package q10.unittests;

import junit.framework.TestCase;
import q10.Functii.FunctiiElementare.*;
import q10.Operatori.*;
import q10.Arbori.*;

public class ProdusTest extends TestCase {
	
	Nod n;
	Nod nec1=new Necunoscuta();
	Nod nec2=new Necunoscuta();

	protected void setUp() throws Exception {
		n=new Produs();
		n.setfDrept(nec1);
		n.setfStang(nec2);
	}

	protected void tearDown() throws Exception {
		n=null;
	}

	public void testDerivare() {
		String rez=this.n.getfStang().derivare()+"*"+this.n.getfDrept().derivare();
		assertEquals(rez,this.n.derivare());
	}

	public void testCalculDerivata() {
		double rez=(this.n.getfStang().calculDerivata()*this.n.getfDrept().calcul())+(this.n.getfStang().calcul()*this.n.getfDrept().calculDerivata());
		assertEquals(rez,this.n.calculDerivata());
	}

	public void testConcatTermeni() {
		String rez=this.n.getfStang()+"*"+this.n.getfDrept();
		assertEquals(rez,this.n.toString());
	}

	public void testCalcul() {
		double rez=this.n.getfDrept().calcul()*this.n.getfStang().calcul();
		assertEquals(rez,this.n.calcul());
	}


}
